//
//  NGCWKWebViewDelegate.h
//  centauriOS_Youe
//
//  Created by gdy on 2018/6/13.
//  Copyright © 2018年 高栋阳. All rights reserved.
//
#import <WebKit/WebKit.h>
@protocol NGCWKNavigationDelegate <NSObject>

@optional
// 页面开始加载时调用
- (void)NGCWKWebView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation;
// 当内容开始返回时调用
- (void)NGCWKWebView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation;
// 页面加载完成之后调用
- (void)NGCWKWebView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation;
// 页面加载失败时调用
- (void)NGCWKWebView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation;
- (void)NGCWKWebViewWebContentProcessDidTerminate:(WKWebView *)webView;
// 接收到服务器跳转请求之后调用
- (void)NGCWKWebView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation;
// 在收到响应后，决定是否跳转
- (void)NGCWKWebView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler;
// 在发送请求之前，决定是否跳转
- (void)NGCWKWebView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;
@end


@protocol NGCWKUIDelegate <NSObject>
@optional
- (void)NGCWebView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler;
- (void)NGCWebView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL))completionHandler;
- (void)NGCWebView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * _Nullable))completionHandler;
@end

